
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">

	<ui:define name="body">
		<h:form prependId="false">

			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:commandButton value="#{messages['button.save']}" action="#{tbRelatorioDiarioEditMB.insert}"
						rendered="#{!tbRelatorioDiarioEditMB.updateMode}" ajax="false" />
					<p:commandButton value="#{messages['button.save']}" action="#{tbRelatorioDiarioEditMB.update}"
						rendered="#{tbRelatorioDiarioEditMB.updateMode}" ajax="false" />
					<p:commandButton value="#{messages['button.delete']}" onclick="confirmation.show()"
						rendered="#{tbRelatorioDiarioEditMB.updateMode}" type="button" immediate="true" ajax="false" />
					<p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.delete']}" severity="alert" widgetVar="confirmation">
						<h:commandButton value="#{messages['button.dialog.yes']}" action="#{tbRelatorioDiarioEditMB.delete}" immediate="true"
							ajax="false" />
						<h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>

			<br />

			<p:fieldset legend="#{messages['tbRelatorioDiario.label']}" toggleable="true" toggleSpeed="500">
				<h:panelGrid id="fields" columns="3">
										
					<h:outputLabel value="#{messages['tbRelatorioDiario.label.dtInicio']}: " for="dtInicio" styleClass="text-input" />
					<p:calendar id="dtInicio" value="#{tbRelatorioDiarioEditMB.tbRelatorioDiario.dtInicio}"
					   pattern="#{messages['label.date.pattern']}" navigator="true" showButtonPanel="true"
					   locale="#{currentLocale}" title="#{messages['tbRelatorioDiario.alt.dtInicio']}" />
					   <p:message for="dtInicio" />
								
					<h:outputLabel value="#{messages['tbRelatorioDiario.label.dtFim']}: " for="dtFim" styleClass="text-input" />
					<p:calendar id="dtFim" value="#{tbRelatorioDiarioEditMB.tbRelatorioDiario.dtFim}"
					   pattern="#{messages['label.date.pattern']}" navigator="true" showButtonPanel="true"
					   locale="#{currentLocale}" title="#{messages['tbRelatorioDiario.alt.dtFim']}" />
					   <p:message for="dtFim" />
					<p:commandButton reRender="list" value="Consultar" action="#{tbRelatorioDiarioEditMB.emitirRelatorio()}" ajax="false"/>
				</h:panelGrid>
			</p:fieldset>
			
			<p:dataTable id="tbl" var="bean" value="#{tbRelatorioDiarioEditMB.columns}" emptyMessage=" " paginator="false" rows="20">
				<f:facet name="header"></f:facet>
				<p:column headerText="#{messages['tbRelatorioDiario.label.nmFuncionario']}">
						<h:outputText value="#{bean.funcionario}" />
				</p:column>
				<p:column headerText="#{messages['tbRelatorioDiario.label.nmServico']}">
						<h:outputText value="#{bean.servico}" />
				</p:column>
				<p:column headerText="#{messages['tbRelatorioDiario.label.vlUnitario']}">
						<h:outputText value="#{bean.vlUnitServico}" />
				</p:column>
				<p:column headerText="#{messages['tbRelatorioDiario.label.qtdServicos']}">
						<h:outputText value="#{bean.qtdServicos}" />
				</p:column>
				<p:column headerText="#{messages['tbRelatorioDiario.label.vlTotalServico']}">
						<h:outputText value="#{bean.vlTotalServico}" />
				</p:column>
				<p:column headerText="#{messages['tbRelatorioDiario.label.pcSalao']}">
						<h:outputText value="#{bean.pcSalao}" />
				</p:column>
				<p:column headerText="#{messages['tbRelatorioDiario.label.pcFuncionario']}">
						<h:outputText value="#{bean.pcFuncionario}" />
				</p:column>
			</p:dataTable>
			
			<h:outputText value="Valor Total dos Serviços R$ #{tbRelatorioDiarioEditMB.vlTotalServicos}"/><br />
			<h:outputText value="Valor Total do Salão R$ #{tbRelatorioDiarioEditMB.vlTotalSalao}" />

			<!-- h:panelGrid>  
			    <p:panel header="Exportar para PDF"> 
			        <h:commandLink>  
			            <p:graphicImage value="/images/pdf.jpg" />  
			            <p:dataExporter type="pdf" target="tbl" fileName="bean"/>  
			        </h:commandLink>  
			    </p:panel>  
			</h:panelGrid-->
		</h:form>
	</ui:define>
</ui:composition>